{template 'common/header'}
<div class="main">
    <ul class="nav nav-tabs">
        <li{if $_GPC['do'] == 'manage' || $_GPC['do'] == '' } class="active"{/if}><a href="{php echo $this->createWebUrl('manage');}">契约管理</a></li>
        <li{if $_GPC['do'] == 'post'} class="active"{/if}><a href="{php echo url('platform/reply/post',array('m'=>'ewei_dream'));}">添加契约</a></li>

    </ul>


    <div class="panel panel-info">
        <div class="panel-heading">筛选</div>
        <div class="panel-body">
            <form action="./index.php" method="get" class="form-horizontal" role="form">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="ewei_dream" />
                <input type="hidden" name="do" value="manage" />
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">关键字</label>
                    <div class="col-sm-8 col-lg-9">
                        <input class="form-control" name="keyword" id="" type="text" value="{$_GPC['keyword']}">
                    </div>
                    <div class=" col-xs-12 col-sm-2 col-lg-2">
                        <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                    </div>
                </div>
                <div class="form-group">
                </div>
            </form>
        </div>

    </div>

    <div style="padding:15px;">
        <table class="table table-hover">
            <thead class="navbar-inner">
                <tr><th class='with-checkbox'  style='width:30px;'>
                        <input type="checkbox" class="check_all" /></th>
                    <th>契约名称</th>
                    <th>查看人数</th>
                    <th>参与人数</th>
                    <th>分享次数</th>
                 
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {loop $list $row}
                <tr>

                    <td class="with-checkbox">
                        <input type="checkbox" name="check" value="{$row['rid']}"></td>	 
                    <td>{$row['title']} </td>
                    <td>{$row['views']}</td>
                    <td>{$row['fans']}</td>
                    <td>{$row['shares']}</td>
                    <td >
                     <a  class="btn btn-default"  href="../app/index.php?i={php echo $this->weid}&c=entry&rid={$row['rid']}&do=dream&m=ewei_dream" target="_blank"><i class="fa fa-vine"></i> 预览</a>
                        
                        <a href="{php echo $this->createWebUrl('fans',array('rid'=>$row['rid']))}" class="btn  btn-default" rel="tooltip" title="查看用户"><i class="fa fa-cog"></i>查看用户</a>
                        <a class="btn btn-default" rel="tooltip" href="{php echo url('platform/reply/post',array('m'=>'ewei_dream','rid'=>$row['rid']));}" title="编辑"><i class="fa fa-edit"></i></a>
 
                        <a class="btn  btn-default" rel="tooltip" href="#" onclick="drop_confirm('您确定要删除吗?', '{php echo $this->createWebUrl('delete',array('rid'=>$row['rid']))}');" title="删除"><i class="fa fa-times"></i></a>
                    </td>
                </tr>
                {/loop}
                <tr>  
                    <td colspan="6">

                        <input type="button" class="btn btn-primary" name="deleteall" value="删除选择的" />
                    </td>
                </tr>
            </tbody>
        </table>
        {$pager}
    </div>

</div>
<script language='javascript'>
            function drop_confirm(msg, url){
            if (confirm(msg)){
            window.location = url;
            }
            }
    $(function(){

    $(".check_all").click(function(){
    var checked = $(this).get(0).checked;
            $("input[type=checkbox]").attr("checked", checked);
    });
            $("input[name=deleteall]").click(function(){

    var check = $("input:checked");
            if (check.length < 1){
    alert('请选择要删除的记录!');
            return false;
    }
    if (confirm("确认要删除选择的记录?")){
    var id = new Array();
            check.each(function(i){
            id[i] = $(this).val();
            });
            $.post("{php echo $this->createWebUrl('deleteAll')}", {idArr:id}, function(data){location.reload();}, 'json');
    }

    });
    });
</script>
{template 'common/footer'}